package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 平台积分结算操作类型枚举
 * @author 伍将
 * @date 2020/11/18
 * @version 2.0.0
 */
public enum SettleAccountPlatformScoreOperateTypeEnum {

    /**
     * 待对账
     */
    TO_BE_ACCOUNTS(1, "待对账", "/memberCenter/balance/platformSettlement/integral"),
    /**
     * 待付款
     */
    TO_BE_PAY(2, "待付款", "/memberCenter/balance/platformSettlement/integral"),
    /**
     * 待收款
     */
    TO_BE_RECEIPT(3, "待收款", "/memberCenter/balance/platformSettlement/integral"),
    /**
     * 已完成
     */
    COMPLETE(4, "已完成", "/memberCenter/balance/platformSettlement/integral");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    SettleAccountPlatformScoreOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static SettleAccountPlatformScoreOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(SettleAccountPlatformScoreOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
